package com.ht.common.core.enums;

import com.ht.common.core.annotation.EnumDictType;
import com.ht.common.core.exception.ServiceException;

import java.util.Arrays;
import java.util.List;

/**
 * @Title: UserTypeEnum.java
 * @Description: 用户类型枚举
 * @author zmx
 * @date 2021年12月30日
 * @version V1.0
 */
@EnumDictType(dictType="user_type",dictName="用户类型枚举")
public enum UserTypeEnum {
		SYS_USER("00","系统用户"),
		BGQY_USER("1","报关企业用户"),
		HZQY_USER("2","货主企业用户"),
		HCQY_USER("3","货场企业用户");

	private final static List<String> ENT_USER_LIST = Arrays.asList(BGQY_USER.code, HZQY_USER.code,HCQY_USER.code);
	private final static List<String> FIELD_USER_LIST = Arrays.asList(HCQY_USER.code);

	    private final String code;
	    private final String name;

	    UserTypeEnum(String code, String name)
	    {
	        this.code = code;
	        this.name = name;
	    }

    public static boolean isEntUser(String userType) {
			return ENT_USER_LIST.stream().anyMatch(d -> d.equals(userType));
    }

	public static boolean isFieldUser(String userType) {
		return FIELD_USER_LIST.stream().anyMatch(d -> d.equals(userType));
	}

	public String getCode()
	    {
	        return code;
	    }

		public String getName() {
			return name;
		}


}
